#include "queue.hpp"
#include "task.hpp"
#include <future>
#include <print>
#include <threadpool.hpp>
#include <vector>

int main() {
  Thread::threadpool pool;

  std::vector<std::future<int>> futures;
  for (int i = 0; i < 1000000; i++) {
    futures.push_back(pool.submit([]() {
      int sum = 0;
      for (int i = 0; i < 1000; i++) {
        sum += i;
      }
      return sum;
    }));
  }

  int count = 0;
  for (auto &h : futures) {
    h.get();
    count++;
  }
  std::println("count: {}", count);

  return 0;
}